package gps.monitor.gpsbootstrap.tool;

import org.springframework.context.ConfigurableApplicationContext;

/**
 * @author cyq
 * @date 2021/11/6
 * @desc talk is cheep,show me the code
 */
public final class LocalBeanTool {

    private static ConfigurableApplicationContext context = null;

    public static void init(ConfigurableApplicationContext c) {
        context = c;
    }

    public static <T> T getBean(Class<T> clazz) {
        if (context == null) return null;
        return context.getBean(clazz);
    }
}
